import formBuilder from "@/comps/form/formBuilder";
import apiBuyer from "../../Buyer/js/api";
import apiSeller from "../../Seller/js/api";
import apiOrderCat from "../../OrderCategory/js/api";
import apiOrderStatus from "../../OrderStatus/js/api";

export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addSearch("buyerId").setLabel("买方").setSpan(6).setInputPositionRight()
            .setApi(apiBuyer.urlChoice).setApiSearchKeys(["name__like","short__like"])

        fb.addSearch("sellerId").setLabel("卖方").setSpan(6).setInputPositionRight()
            .setApi(apiSeller.urlChoice).setApiSearchKeys(["name__like","short__like"])

        fb.addText("sn").setSpan(3).setLabel("订单号")
            .setRules([fb.R.notNull("订单号不能为空")])

        fb.addText("cost").setSpan(3).setLabel("费用").setTypeNumber()
            .setRules([fb.R.notNull("费用不能为空")])

        fb.addCascade("catId","订单分类","3")
            .setApi(apiOrderCat.urlTree)

        fb.addCascade("statusId","订单状态","3")
            .setApi(apiOrderStatus.urlTree)


        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}